R demo | Correlation Matrix | How to conduct, visualise and interpret
HTML-код
- Опубликовано: 22 авг 2024
- Having several numeric variables, we often wanna know which of them are correlated and how. Correlation Matrix seems to be a good solution for it. But drawing conclusions from plain correlation coeffitients and p-values is dangerous, if we don’t visualize the data. Let’s learn a better way to produce a correlation matrix.
Here is a quick R code:
install.packages("PerformanceAnalytics")
library("PerformanceAnalytics")
chart.Correlation(iris[, 1:3])
install.packages("tidyverse")
library(tidyverse) # for "aes()"
install.packages("GGally")
library(GGally)
ggpairs(iris,
columns = 1:3,
aes(colour=Species),
lower = list(continuous = "smooth"),
upper = list(continuous = wrap("cor",
method = "pearson")))
If you only want more code (or want to support me), consider join the channel (join button below any of the videos), because I provide the code upon members requests.
Enjoy! 🥳
great practical content! thanks
Glad it was helpful!
You are life saver!!!
I am glad it's useful! Thank you for watching!
Simpson's paradox !
totally 😁👍 I see it way to often in the medical research
Nice work, thank you.
You are very welcome, Ömer! :)
Thank you Sir!
You are welcome!
Thank you Sir!,
Most welcome! :)
"Package ‘fastStat’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2021-07-30 as check problems were not corrected in time. "
Hi, how could we go on with the tutorial?
Hi Myroslav, the fastStat works on my computer somehow, but it was not the point of this video. The point was to stop using it, because ... of the reasons I talk about further into the video. I hope you enjoy the rest and will find it useful. There is a link in the description below the video to my blog, where you have R code.
Great video that can do correlation for each specific type of variables! However, I can't do the normality test as its said no normality function available?
Great point! It's probably because you did not use the code above, where I should how to install and load "dlookr" package. Normality function coms from dlookr. install.packages("dlookr")
library(dlookr)
How can we quickly check for linearity programmatically in code, without plots? Or should wie check for normality of residuals of a lm-fit. Would it be the same?
you can actually check all the assumptions in one command "check_model()", visually! check out my video on {performance} package.
@@yuzaR-Data-Science I saw it multiple times. Actually I want only check for linearity of a vector of numbers, non-visually from within an automation.
one vector can not be checked for linearity, because linear against what? only for normality of distribution can be checked there. with all the other linearity things, you need at least two numeric variable, or, in the regression with multiple variables, you see the second plot of the residuals from check_model() function
@@yuzaR-Data-Science Actually I need a linearity-p-value (if exists) of two variables, so I can store it, or process it further. Is there a dedicated package for this?